package cn.com.zj.rpc.provider;

import cn.com.zj.rpc.provider.server.MyRpcServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ServerBootstrapApplication implements CommandLineRunner {

    @Autowired
    MyRpcServer myRpcServer;

    public static void main(String[] args) {
        SpringApplication.run(ServerBootstrapApplication.class, args);
    }


    @Override
    public void run(String... args) throws Exception {
        new Thread(new Runnable() {
            @Override
            public void run() {
                myRpcServer.startServer("127.0.0.1",9998);
            }
        }).start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                myRpcServer.startServer("127.0.0.1",9999);
            }
        }).start();

    }
}
